{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# PMOD TC1 Sensor demonstration\n",
    "\n",
    "This demonstration shows how to use the PmodTC1. You will also see how to plot a graph using matplotlib.\n",
    "\n",
    "The PmodTC1 is required.\n",
    "\n",
    "The thermocouple sensor is initialized and set to log a reading every 1 second.  The temperature of the sensor\n",
    "can be changed by touching it with warm fingers or by blowing on it."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1. Use TC1 to read the current temperature\n",
    "Connect the TC1 sensor to PMODB."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from pynq.overlays.base import BaseOverlay\n",
    "base = BaseOverlay(\"base.bit\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Raw Register Value: 014416b0 hex\n",
      "Ref Junction Temp:  22.6875\n",
      "Thermocouple Temp:  20.25\n",
      "Alarm flags:        00000000 hex\n"
     ]
    }
   ],
   "source": [
    "from pynq.lib import Pmod_TC1\n",
    "\n",
    "# TC1 sensor is on PMODB\n",
    "my_tc1 = Pmod_TC1(base.PMODB)\n",
    "print('Raw Register Value: %08x hex' % my_tc1.read_raw())\n",
    "print('Ref Junction Temp:  %.4f' % my_tc1.read_junction_temperature())\n",
    "print('Thermocouple Temp:  %.2f' % my_tc1.read_thermocouple_temperature())\n",
    "print('Alarm flags:        %08x hex' % my_tc1.read_alarm_flags())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. Starting logging temperature once every second\n",
    "Users can use `set_log_interval_ms` to set the time elapsed during 2 samples. By default it is set to 1 second."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "my_tc1.start_log()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3. Modifying the temperture\n",
    "\n",
    "* Touch the thermocouple with warm fingers; or\n",
    "* Blow on the thermocouple with cool air\n",
    "\n",
    "Stop the logging whenever you are finished trying to change the sensor's value."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "my_tc1.stop_log()\n",
    "log = my_tc1.get_log()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4. Plot values over time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEZCAYAAACU3p4jAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXl4VdW5/z9v0KIgISAKApKEUDo4xbmWqomWTmJtb6tV\nAxqHem+tVCq2WmkMMdarvXirxdvJqnGgxaG3WkUrqERvrYgTimgtkhAxgApEJgs/Ie/vj73P4SSc\nk+yTM+11zvt5nv3k7LXX8D0rZ7977Xev/S5RVQzDMIz8pyjXAgzDMIzsYAbfMAyjQDCDbxiGUSCY\nwTcMwygQzOAbhmEUCGbwDcMwCgQz+IbhACJyh4hck2sdhtuYwTdyjohsFpFN/rZTRD6KSTvLzzNe\nRO4TkQ9EpENElojID0VE/OO/FZF/+OXP6aW9USLyQExdr/VWxjDyATP4Rs5R1UGqWqyqxUAbcEpM\n2h9FpAJY5B87WFWHAKcDRwCD/GqWAN8DXgrQ5N1+XQcC+wJTgPfS+qVSQET65VqDkZ+YwTfChvhb\nLDOBZ1X1R6r6HoCqLlfVKaq6yd//taouBLYHaONo4E5V3aaqnar6qqo+HhUg8jkRedYf/b8iIifG\nHFsoIteIyN/8O5C/ishQ/1h/EblbRNb5ZZ8Xkf38YweIyEMisl5E/ikiF8bUWS8i9/tlPwT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x30543af0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "from pynq.lib.pmod.pmod_tc1 import reg_to_tc\n",
    "from pynq.lib.pmod.pmod_tc1 import reg_to_ref\n",
    "\n",
    "tc = [reg_to_tc(v) for v in log]\n",
    "ref = [reg_to_ref(v) for v in log]\n",
    "\n",
    "plt.plot(range(len(tc)), tc, 'ro', label='Thermocouple')\n",
    "plt.plot(range(len(ref)), ref, 'bo', label='Ref Junction')\n",
    "plt.title('TC1 Sensor log')\n",
    "plt.axis([0, len(log), min(tc+ref)*0.9, max(tc+ref)*1.1])\n",
    "plt.legend()\n",
    "plt.xlabel('Sample Number')\n",
    "plt.ylabel('Temperature (C)')\n",
    "plt.grid()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3+"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
